<template>
	<view class="w100 flex flex_jc flex_wrap">
		
		<!-- 格子广告 -->
		<view class="grid_left">
			<ad-custom :unit-id="xcx_ad.GridLeftId" 
			bindload="adLoad" binderror="adError" bindclose="adClose"></ad-custom>
		</view>
		
		<view class="grid_right" :style="{left: (_windowWidth-70)+'px'}">
			<ad-custom :unit-id="xcx_ad.GridRightId" 
			bindload="adLoad" binderror="adError" bindclose="adClose"></ad-custom>
		</view>
		
		<view class="w100 flex flex_jc" style="position: fixed;top: 0;z-index: 9999;"  v-if="show_ad">
			<ad :unit-id="xcx_ad.video" ad-type="video" ad-theme="white"  v-if="show_ad"></ad>
		</view>
		<view :class="show_ad?'mt580':''">
			<navigator :url="'/pages/juji_detail/index?id='+item.id" class="li w710 mt20 flex flex_ac" v-for="(item,index) in juji_list">
				<view class="img">
					<u--image :showLoading="true" :src="item.cover" width="100%" height="100%"></u--image>
				</view>
				<view class="detail flex flex_ac flex_wrap">
					<view class="name fz40 w100">{{item.name}}</view>
					<view class="introdduce fz25 col_999 hidden4">{{item.clear_introduce}}</view>
				</view>
			</navigator>
		</view>
		
		
	</view>
</template>

<script>
	import adSdk from "@/utils/advertise.js"
	import {getJujiList} from "@/api/api"
	export default {
		data() {
			return {
				page:1,
				juji_list:[],
				juji_count:0,
				tips:'数据加载中',
				xcx_ad:getApp().globalData.xcx_ad,
				show_ad:getApp().globalData.show_ad,
				_windowWidth:getApp().globalData._windowWidth,
				_windowHeight:getApp().globalData._windowHeight,
				
			}
		},
		
		
		onLoad: function (option) {
			this.getJujiList()
		},
		
		onShow:function(){
			adSdk.initInterstitial(this.xcx_ad.interstitialId)
			adSdk.showInterstitial()
		},
		
		onReachBottom(){
			
			if(this.juji_list.length>=this.juji_count){
				this.tips = '所有数据加载完成'
			}else{
				this.page += 1
				this.getJujiList()
			}
		
		},
	
		methods:{
			
			getJujiList(){
				getJujiList(this.page).then(res=>{
					this.juji_count = res.data.total
					var data = res.data.data
					for(var i = 0 ;i<data.length;i++){
						
						this.juji_list.push(data[i])
					}
					if(this.juji_list.length>=this.juji_count){
						this.tips = '所有数据加载完成'
					}
				})
			},
		
		}
	}
</script>
<style>
	.u-transition{width: 100%;height: 100%;}
</style>
<style scoped>
	.li .detail{width: 490rpx;height: 240rpx;}
	.li{border-radius: 20rpx;background-color: beige;box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.42);}
	.li .img{width: 160rpx;height: 240rpx;padding: 20rpx;}
	
</style>